﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Buy2Site.Classes
{
    public class ProductClass
    {
        public int UserID { get; set; }
        public string Title { get; set; }
        public string ShortDescription { get; set; }
        public string LongDescription { get; set; }
        public DateTime Date { get; set; }
        public double Price { get; set; }
        public byte[] Picture1 { get; set; }
        public byte[] Picture2 { get; set; }
        public byte[] Picture3 { get; set; }
        public string State { get; set; } // can be also enum

        public List<ProductClass> ListOfItems { get; set; }
        public List<ProductClass> ListOfAllQuantetiesItems { get; set; }

        public static List<Product> GetAllProducts()
        {
            List<Product> listOfProducts = null;
            using (Buy2SiteDBEntities dbEnt = new Buy2SiteDBEntities())
            {
                var products = from element in dbEnt.Product
                            select element;
                listOfProducts = products.ToList();
            }
            return listOfProducts;
        }
    }
}